'use strict';

/**
 * 上课考勤schema
 */
const mongoose = require('mongoose'), Schema = mongoose.Schema;

const classAttendanceSchema = new Schema({
    school_name: { type:String }, //在读学校名称
    grade_name: { type:String }, //年级

    group_id: {type:String}, //集团id
    group_name: {type:String}, //集团名称
    campus_id: {type:String}, //上课校区id
    campus_name: {type:String}, //上课校区

    class_id: { type: String }, //班级id
    lesson_id: {type: String}, //课次id
    classroom_id: { type:String },//教室id


    classroom_name: { type:String }, //教室名称
    class_num: { type:String },//班级编号
    class_name: { type:String },//班级名称
    class_type: { type:String },//项目
    class_teacher: { type:String },//主讲老师

    attendance_start_date: { type:Number, required:true },//上课考勤开始时间
    attendance_end_date: { type:Number, required:true },//上课考勤结束日期
    class_start_time: { type:Number, required:true },//上课时间
    class_end_time: { type:Number, required:true },//结束时间

    is_completed: { type:Number,default:0}, //课程标记已结束并发送消息，0未发送，1已发送
    /* 
        上课情况
        @param:student_collection
        @demo: [{student_id:1,student_name:'abc',student_num:'123',attendance_start_time:'',attendance_end_time:''}]
    */
    student_collection:{ type: Schema.Types.Mixed },//上课情况 
    /* 
        教室设备
        @param:device_collection
        @demo: [{device_id:1,device_name:'abc',device_num:'123'}]
    */
    device_collection:{ type: Schema.Types.Mixed } //教室设备
})

module.exports = mongoose.model('classAttendanceModel', classAttendanceSchema, 'classAttendance')